import re

# Default：贪心
hahaRegex = re.compile(r'(Ha){3,5}')
# mo1 = hahaRegex.search('HaHaHa12345678910HaHaHaHa112233445566778899')
mo1 = hahaRegex.search('HaHaHaHa')
print(mo1.group())

# 问号(?)版：非贪心
hahahaRegex = re.compile(r'(Ha){3,5}?')
mo2 = hahahaRegex.search('HaHaHaHaHa')
print(mo2.group())
